package com.bjxst.service.impl;

import com.bjxst.dao.UserManagerDao;
import com.bjxst.dao.impl.UserMangerDaoImpl;
import com.bjxst.pojo.Users;
import com.bjxst.service.UserManagerService;

import java.util.List;

/*用户管理业务层*/
public class UserManagerServiceImpl implements UserManagerService {
    //添加用户
    @Override
    public void addUser(Users users) {
        UserManagerDao um = new UserMangerDaoImpl();
        um.insertUser(users);
    }

    //查询用户  直接return调用的方法
    @Override
    public List<Users> findUser(Users users) {
        UserManagerDao um = new UserMangerDaoImpl();
        return um.selectUserByProperty(users);
    }


    //根据用户id查询  预更新的查询
    @Override
    public Users findUserById(int userid) {
        UserManagerDao um = new UserMangerDaoImpl();

        return um.selectByUserid(userid);
    }
/*更新用户*/
    @Override
    public void modifyUser(Users users) {
        UserManagerDao um = new UserMangerDaoImpl();
         um.updateUserByUserid(users);
    }

    /*删除用户*/
    @Override
    public void dropUser(int userid) {
        UserManagerDao um = new UserMangerDaoImpl();
        um.deleteUserByUserid(userid);
    }
}
